waypt: Add functions for speed and distance calculation.
authoroliskoli <oliskoli>
Mon, 20 Aug 2007 22:00:09 +0000 (22:00 +0000)
committeroliskoli <oliskoli>
Mon, 20 Aug 2007 22:00:09 +0000 (22:00 +0000)
Add seperate project file for misc. GPS data parser functions.
Add support for 'Swiss grid'.

Makefile.in
defs.h
garmin_tables.c

index f2ba350a9557ae9b3dc9c1dcfe0fec3f13b25de8..c09e0117fdef85026746df7e87ca4a8fde64a34e 100644 (file)
@@ -85,7 +85,7 @@ LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \
           csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o \
           uuid.o formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \
          xhtmlent.o inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ gbser.o \
-         gbfile.o \
+         gbfile.o parse.o \
        $(PALM_DB) $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS)
 OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@
 
@@ -586,6 +586,7 @@ palmdoc.o: palmdoc.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \
   jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \
   jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \
   pdbfile.h
+parse.o: parse.c defs.h config.h queue.h gbtypes.h jeeps/gpsmath.h
 pathaway.o: pathaway.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \
   zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h csv_util.h strptime.h \
   pdbfile.h
diff --git a/defs.h b/defs.h
index 11fbe25aa6b57dd804d458779ed0f49c9da0574a..0a29c5443fcfcb83ecea255aa9e239badfab11ab 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -699,6 +699,10 @@ void waypt_disp(const waypoint *);
 void waypt_status_disp(int total_ct, int myct);
 double waypt_time(const waypoint *wpt);
 double waypt_speed(const waypoint *A, const waypoint *B);
+double waypt_speed_ex(const waypoint *A, const waypoint *B);
+double waypt_course(const waypoint *A, const waypoint *B);
+double waypt_distance(const waypoint *A, const waypoint *B);
+double waypt_distance_ex(const waypoint *A, const waypoint *B);
 
 NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2);
 void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3);
@@ -892,17 +896,23 @@ typedef enum {
        grid_lat_lon_dmm = 1,
        grid_lat_lon_dms = 2,
        grid_bng = 3,
-       grid_utm = 4
+       grid_utm = 4,
+       grid_swiss = 5
 } grid_type;
 
 #define GRID_INDEX_MIN grid_lat_lon_ddd
-#define GRID_INDEX_MAX grid_utm
+#define GRID_INDEX_MAX grid_swiss
 
 #define DATUM_OSGB36   86
 #define DATUM_WGS84    118
 
+/*
+ *  From parse.c
+ */
 int parse_coordinates(const char *str, int datum, const grid_type grid,
        double *latitude, double *longitude, const char *module);
+int parse_distance(const char *str, double *val, double scale, const char *module);
+int parse_speed(const char *str, double *val, const double scale, const char *module);
 
 /*
  *  From util_crc.c
index 3bae4469ca7c8b31c4d110e2d531ac49690fb253..4dadeae70d21d529eb04fb518591f4b3e8043ac0 100644 (file)
@@ -617,6 +617,7 @@ grid_mapping_t gt_mps_grid_names[] =
        { "dms",        "Lat/Lon hddd*mm'ss.s\"",       grid_lat_lon_dms },
        { "bng",        "British National Grid",        grid_bng },
        { "utm",        "UTM",                          grid_utm },
+       { "swiss",      "Swiss grid",                   grid_swiss },
        { NULL, NULL,   0 }
 };